package com.ezgo.erc.mq.consumer;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class ConsumerMessageListener implements MessageListener {

	private Log logger = LogFactory.getLog(this.getClass());

	@Override
	public void onMessage(Message message) {
		if (message instanceof TextMessage) {
			TextMessage text = (TextMessage) message;
			logger.info("Receive a plain text message");
			try {
				logger.info("Received message:" + text.getText());
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}

}